﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace Labirinto_Magico
{
    public class GameGUIHandler
    {
        public GUIButton mPause = null;
        public GUILabel mScore = null;
        public GUIChessboard mChessboard = null;
        public GUITimingLabel mTurnAndVictory = null;

        public GameGUIHandler()
        { }

        public void InitGUI(Game iGame, LabyrinthGameState.State iState, float iTileLenght, Tile.Tile iRemained, float iViewportWidth, float iViewportHeight)
        {
            List<GUIButton> buttons = new List<GUIButton>();
            float startHeight;
            
            Vector2 buttonRender = new Vector2(iGame.GraphicsDevice.Viewport.Width * 0.25f, iGame.GraphicsDevice.Viewport.Height * 0.2f);
            startHeight = iGame.GraphicsDevice.Viewport.Height - buttonRender.Y * 0.7f;
            mPause = new GUIButton(
                "Pause",
                new Vector2(iGame.GraphicsDevice.Viewport.Width - buttonRender.X * 0.7f, startHeight),
                buttonRender);

            Vector2 labelRender = new Vector2(iGame.GraphicsDevice.Viewport.Width * 0.25f, iGame.GraphicsDevice.Viewport.Height * 0.3f);
            startHeight -= buttonRender.Y * 0.5f;
            startHeight -= labelRender.Y * 0.5f;
            mScore = 
                new GUILabel(
                    "Score",
                    new Vector2(iGame.GraphicsDevice.Viewport.Width - labelRender.X * 0.7f, startHeight - 10),
                    labelRender);

            Vector2 victoryRender = new Vector2(iGame.GraphicsDevice.Viewport.Width * 0.5f, iGame.GraphicsDevice.Viewport.Height * 0.5f);
            mTurnAndVictory = 
                new GUITimingLabel(
                    "VictoryTurn",
                    new Vector2(iGame.GraphicsDevice.Viewport.Width * 0.5f, iGame.GraphicsDevice.Viewport.Height * 0.5f),
                    victoryRender);

            mChessboard = new GUIChessboard();
            mChessboard.Init(iTileLenght, iRemained, iViewportWidth, iViewportHeight);
        }
        
    }
}
